/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sys.utils;

/**
 *
 * @author Administrador
 */
public class PrinterOptions {

    String commandSet = "";

// INICIALIZA A IMPRESSORA
    public String initialize() {

        final byte[] Init = {27, 64};
        commandSet += new String(Init);
        return new String(Init);

    }

// ALTERA A FONTE
    public String chooseFont(int Options) {

        String s = "";

        final byte[] ChooseFontA = {27, 77, 0};
        final byte[] ChooseFontB = {27, 77, 1};
        final byte[] ChooseFontC = {27, 77, 48};
        final byte[] ChooseFontD = {27, 77, 49};

        switch (Options) {

            case 1:
                s = new String(ChooseFontA);
                break;
            case 2:
                s = new String(ChooseFontB);
                break;
            case 3:
                s = new String(ChooseFontC);
                break;
            case 4:
                s = new String(ChooseFontD);
                break;
            default:
                s = new String(ChooseFontB);
        }

        commandSet += s;

        return new String(s);

    }

// VOLTA UM POUCO O PAPEL
    public String feedBack(byte lines) {

        final byte[] Feed = {27, 101, lines};
        String s = new String(Feed);
        commandSet += s;

        return s;

    }

// AVANÇA O PAPEL
    public String feed(byte lines) {

        final byte[] Feed = {27, 100, lines};
        String s = new String(Feed);
        commandSet += s;

        return s;

    }

// ALINHA A ESQUERDA
    public String alignLeft() {

        final byte[] AlignLeft = {27, 97, 48};
        String s = new String(AlignLeft);
        commandSet += s;

        return s;

    }

// CENTRALIZA O TEXTO
    public String alignCenter() {

        final byte[] AlignCenter = {27, 97, 49};
        String s = new String(AlignCenter);
        commandSet += s;

        return s;

    }

// ALINHA A DIREITA
    public String alignRight() {

        final byte[] AlignRight = {27, 97, 50};
        String s = new String(AlignRight);
        commandSet += s;

        return s;

    }

// ADICIONA UMA LINHA
    public String newLine() {

        final byte[] LF = {10};
        String s = new String(LF);
        commandSet += s;
        return s;

    }

// DEIXA O TEXTO EM NEGRITO
    public String doubleStrik(boolean enabled) {

        final byte[] DoubleStrikeModeOn = {27, 71, 1};
        final byte[] DoubleStrikeModeOff = {27, 71, 0};

        String s = "";

        if (enabled) {
            s = new String(DoubleStrikeModeOn);
        } else {
            s = new String(DoubleStrikeModeOff);
        }

        commandSet += s;

        return s;

    }

// DOBRA O TAMANHO DO TEXTO
    public String doubleHeight(boolean enabled) {

        final byte[] DoubleHeight = {27, 33, 17};
        final byte[] UnDoubleHeight = {27, 33, 0};
        String s = "";

        if (enabled) {
            s = new String(DoubleHeight);
        } else {
            s = new String(UnDoubleHeight);
        }

        commandSet += s;

        return s;

    }

// DEIXA O TEXTO EM UNDERLINE
    public String underLine(int Options) {

        final byte[] UnderLine2Dot = {27, 45, 50};
        final byte[] UnderLine1Dot = {27, 45, 49};
        final byte[] NoUnderLine = {27, 45, 48};

        String s = "";

        switch (Options) {

            case 0:
                s = new String(NoUnderLine);
                break;
            case 1:
                s = new String(UnderLine1Dot);
                break;
            default:
                s = new String(UnderLine2Dot);

        }

        commandSet += s;

        return new String(s);

    }

// PREENCHE UMA LINHA INTEIRA COM O QUE ESTA NA VARIAVEL lineSpace
    public String addLineSeperator() {

        String lineSpace = "------------------------------------------------";
        commandSet += lineSpace;
        return lineSpace;

    }

// LIMPA O BUFFER
    public void resetAll() {
        commandSet = "";
    }

// ADICIONA O TEXTO
    public String setText(String s) {
       // commandSet += s;
        return commandSet += s;
    }

// FINALIZA O BUFFER
    public String finalCommandSet() {
        return commandSet;
    }

}
